package com.example.android.services

import com.example.android.extensions.StringBody
import com.example.android.utils.Api
import com.example.android.utils.JsonUtil
import com.example.android.utils.models.Form
import com.example.android.utils.models.MyResult

/**
 * @ClassName OnlineChatService
 * @Author Ryan Kamanri
 * @Date 2022/6/13
 * @Description
 **/
class OnlineChatService(
    private val _Api: Api,
    private val _JsonUtil: JsonUtil
) {
    suspend fun GetChatterId(userName: String): MyResult<Form> {
        val resJson = _Api.Get("/user-communication/getId?userName=${userName}")
            .StringBody()

        val result = _JsonUtil.FromJsonObject(resJson).AsMyResult<Form>()

        return result
    }
}